﻿using RestSharp;
using Ymatou.ServiceCenter;
using YmtAuth.AppService;
using YmtAuth.Dto;
using YmtSystem.CrossCutting;
using ResetService = ServiceStack.Service;

namespace YmtAuth.Web.Handlerv2
{
    /// <summary>
    /// 安全问题，双重验证
    /// </summary>
    public class DualSecurityHandler : ResetService
    {
        private IDualSecurityAppService dualSecurityAppService { get { return LocalServiceLocator.GetService<IDualSecurityAppService>(); } }

        /// <summary>
        /// 查询用户是否设置了双重验证
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [ServiceRegister("/json/reply/GetDualSecurityResultRequestDto", Method.GET)]
        public object Get(GetDualSecurityResultRequestDto request)
        {
            return dualSecurityAppService.GetDualSecurityResult(request);
        }

        /// <summary>
        /// 设置用户双重验证
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [ServiceRegister("/json/reply/SetDualSecurityRequestDto", Method.POST)]
        public object Post(SetDualSecurityRequestDto request)
        {
            return dualSecurityAppService.SetDualSecurity(request);
        }
    }
}